package com.mystnihon.freeremote.util;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.database.Cursor;
import android.support.v4.content.AsyncTaskLoader;

import com.mystnihon.freeremote.db.table.SeedboxTable;

public class SeedboxLoader extends AsyncTaskLoader<List<SeedboxTable>> {

	public SeedboxLoader(Context context) {
		super(context);
		System.out.println("FUCK !!");
	}

	@Override
	public List<SeedboxTable> loadInBackground() {
		System.out.println("loadInBackground :");
		final ArrayList<SeedboxTable> seedbox = new ArrayList<SeedboxTable>();
		Cursor c = getContext().getContentResolver().query(SeedboxTable.CONTENT_URI, SeedboxTable.CONTENT_PROJECTION, null, null, null);
		if (c != null) {
			while (c.moveToNext()) {
				seedbox.add(SeedboxTable.inflateObject(c));
			}
		}
		return seedbox;
	}

}